#pragma once
#include "../../Ode.h"

namespace DoolakhTM
{
	namespace Ode
	{
		ref class DVector3;

		public ref class DVertexBuffer sealed: IUnmanagedPointer
		{
			INTERNAL_CLASS_DECLARATION(DVertexBuffer,dReal);
		private:			
			int sizeInByte;
			int vertexCount;
		public:
			UNMANAGEDPOINTER_DECLARATION();

			///<summary>
			/// Helper class to handle unmanaged vertexbuffer
			///</summary>			
			///<param name = "isSingle"> Is single precision</param>
			///<param name = "vertexCount">  Number of vertices</param>
			DVertexBuffer(int vertexCount)
			{				
				this->vertexCount = vertexCount;
				sizeInByte = vertexCount * 12;
				_This = new dReal[vertexCount * 3]();
			}
			void SetData(array<float>^ data,int startIndex,int lenght);
			void SetData(array<float>^ data);

			void SetVertex(int vertexIndex,dReal x,dReal y,dReal );
			void SetVertex(int vertexIndex,DVector3^ vertex);

			DVector3^ GetReferenceVertex(int vertexIndex);
		};
	}
}